<?php 
namespace app\admin\behavior;

class Clearcache 
{
    public function run(&$params)
    {
        $node = strtolower(request() -> module().'_'.request() -> controller().'_'.request() -> action());
        $nodes = [
            'content_admin.category_add' => ['ebcms_routes','content_categorys','think_route_map'],
            'content_admin.category_edit' => ['ebcms_routes','content_categorys','think_route_map'],
            'content_admin.category_status' => ['ebcms_routes','content_categorys','think_route_map'],
            'content_admin.category_resort' => ['ebcms_routes','content_categorys','think_route_map'],
            'content_admin.category_delete' => ['ebcms_routes','content_categorys','think_route_map'],
            'content_admin.category_merge' => ['ebcms_routes','content_categorys','think_route_map'],
            'admin_config_add' => ['ebcms_routes','content_categorys','think_route_map'],
            'admin_config_edit' => ['ebcms_routes','content_categorys','think_route_map'],
            'admin_config_status' => ['ebcms_routes','content_categorys','think_route_map'],
            'admin_config_delete' => ['ebcms_routes','content_categorys','think_route_map'],
            'admin_config_setting' => ['ebcms_routes','content_categorys','think_route_map'],
            'single_admin.single_add' => ['ebcms_routes','think_route_map'],
            'single_admin.single_edit' => ['ebcms_routes','think_route_map'],
            'single_admin.single_status' => ['ebcms_routes','think_route_map'],
            'single_admin.single_delete' => ['ebcms_routes','think_route_map'],
        ];
        if (isset($nodes[$node])) {
            foreach ($nodes[$node] as $key => $value) {
                \think\Cache::rm($value);
            }
        }
    }
}